import configparser
from pathlib import Path


def read_ini_file():
    config_path = Path(__file__).parent / 'pytest.ini'
    print(config_path)
    if not config_path.exists():
        raise FileNotFoundError("配置文件 config.ini 未找到！")

    config = configparser.ConfigParser()
    config.read(config_path, encoding='utf-8')

    # config_path = r'D:\PythonProject\api_test_erp\config.ini'
    # with open(config_path, 'r', encoding='utf-8') as f:
    #     config_value = f.read()
    #     print(config_value)
    return config